Format Attribute Date Values
Meridian stores date information so that it can be formatted according to the Windows locale settings of users. This may not be the format that you want used in drawing title blocks. If not, you can format the date values that are synchronized with AutoCAD attributes, MicroStation tags, and Revit properties.
There are two levels at which you can convert date values:
- One format for all insertions of the same title block. This is the typical scenario.
- Different format for each insertion of a title block per drawing. This scenario is rare.
To format an attribute date value for all insertions of the same title block:
- In Configurator, expand Environment in the configuration tree and select Application Link Settings. The settings for each link appear in property pages in the right pane.
- Click the AutoCAD/MicroStation/Revit tab. The link’s settings page appears in the right pane.
-
Click the Edit button to modify the settings.
Note:To export the settings file to a location outside the vault, click the Export button. This can be useful if you would rather edit the file in your favorite text editor. You can then copy your changes to the Clipboard and paste them into Configurator.
-
Locate the section in the file that begins with the block name surrounded by square brackets, for example, [MyTitleBlock] and locate the TitleBlockDateFormat setting. If the setting does not exist, you can create it. The value of this setting is options that specify how to format synchronized date and time values using the following format:
TitleBlockDateFormat = D{<DateFormat>} T{<TimeFormat>}
The date and time format options are described in the following tables. The following example formats dates like 11/03/2003:
TitleBlockDateFormat = D{dd/MM/yyyy}
The following example formats dates as 03-Mar-11.
TitleBlockDateFormat = D{yy-MMM/dd}
- Edit the value of TitleBlockDateFormat to meet your requirements.
- Click OK to save your changes.
To format an attribute date value for each insertion of a title block per drawing:
- In Configurator, expand Environment in the configuration tree and select Application Link Settings. The settings for each link appear in property pages in the right pane.
- Click the AutoCAD/MicroStation/Revit tab. The link’s settings page appears in the right pane.
-
Click the Edit button to modify the settings.
Note:To export the settings file to a location outside the vault, click the Export button. This can be useful if you would rather edit the file in your favorite text editor. You can then copy your changes to the Clipboard and paste them into Configurator.
-
Locate the section in the file that begins with the block name surrounded by square brackets, for example, [MyTitleBlock] and locate the TitleBlockDateFormatProperty setting. If the setting does not exist, you can create it. The value of this setting is the internal name of a custom property that specifies how to format date and time values of the title block in the current drawing:
TitleBlockDateFormatProperty = <PropertySet>.<PropertyName>
- Click OK to save your changes.
-
Set the value of the specified property in each drawing to meet your requirements.
The value of the property can be any of the following formats:
D{<DateFormat>} T{<TimeFormat>}
The date and time format options are described in the following tables. The following example formats dates like 11/03/2003:
D{dd/MM/yyyy}
The date format can also be specified without the D parameter, for example:
{dd/MM/yyyy}
If you specify a format that does not include separators between the different time units (ddMMMyyyy, for example) the link will not be able to convert the attribute values to Meridian vault storage format because the meanings of the individual numbers will be ambiguous. To resolve this, you can provide a VBScript rule for Meridian to interpret the date format. Add the following line to the block section described above where <FunctionName> is the name of the VBScript function that you want the link to use to interpret the date/time attribute values in that block. The function name can be anything you want it to be. Different converter functions can be specified for each block definition.
DateTimeConverter=<FunctionName>
For example, if <FunctionName> is DateTimeConverterFunc, the VBScript function must be defined like the following example:
' BlockName - Block name passed from the link ' AttrName - Attribute name passed from the link ' DateStr - Attribute value passed from the link ' Result - Converted value to save as the document property value
Function DateTimeConvertorFunc(BlockName, AttrName, DateStr, Result) On Error Resume Next 'Perform your date/time conversion here Result = DateValue("25.06.2013") 'Return whether or not to use Result DateTimeConvertorFunc = True End Function
If the function returns True, the result will be used as the property value of the linked vault document. If the function returns False, the property value will not be updated.
This function is supported for AutoCAD drawings, sheet sets, and AutoCAD Plant 3D projects only.
The order of conversion precedence is:
- Script function described above
- The property specified in TitleBlockDateFormatProperty
- The format specified by TitleBlockDateFormat
- The format of the system locale
The following table describes the date format options.
Characters | Description |
---|---|
d |
Day of the month as digits with no leading zero for single-digit days |
dd |
Day of the month as digits with leading zero for single-digit days |
ddd |
Day of the week as a three-letter abbreviation associated with the Windows locale |
dddd |
Day of the week as its full name associated with the Windows locale |
M |
Month as digits with no leading zero for single-digit months |
MM |
Month as digits with leading zero for single-digit months |
MMM |
Month as a three-letter abbreviation associated with the Windows locale. Not supported by TitleBlockDateFormatProperty |
MMMM |
Month as its full name associated with the Windows locale |
y |
Year as last two digits with no leading zero for years less than 10 |
yy |
Year as last two digits with leading zero for years less than 10 |
yyyy |
Year as four digits |
The following table describes the time format options.
Characters | Description |
---|---|
h |
Hours with no leading zero for single-digit hours; 12-hour clock |
hh |
Hours with leading zero for single-digit hours; 12-hour clock |
H |
Hours with no leading zero for single-digit hours; 24-hour clock |
HH |
Hours with leading zero for single-digit hours; 24-hour clock |
m |
Minutes with no leading zero for single-digit minutes |
mm |
Minutes with leading zero for single-digit minutes |
s |
Seconds with no leading zero for single-digit seconds |
ss |
Seconds with leading zero for single-digit seconds |
t |
One-character time period, such as A or P |
tt |
Two-character time period, such as AM or PM |